<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>请输入提取码</title>
    <link rel="stylesheet" href="/bootstrap/css/bootstrap.min.css">
    <script src="/js/jquery.min.js"></script>
    <script src="/bootstrap/js/bootstrap.min.js"></script>
    <style>
        a {
            font-family: "微软雅黑";
            cursor: pointer;
        }
        .blur {
            filter: url(blur.svg#blur); /* FireFox, Chrome, Opera */
            -webkit-filter: blur(7px); /* Chrome, Opera */
            -moz-filter: blur(7px);
            -ms-filter: blur(7px);
            filter: blur(7px);
            filter: progid:DXImageTransform.Microsoft.Blur(PixelRadius=7, MakeShadow=false); /* IE6~IE9 */
        }
        #mysecret{
            height: 32px;
            width: 150px;
        }
    </style>
</head>
<body>
<div id="imgbackground" class="blur"
     style="background: url('images/bg1.jpg');top:0; position: fixed;width: 100%;height: 100%;z-index: -1;">
</div>

<div id="container" class="container"
     style="width: 90%;height:500px;margin:20px auto; background-color: rgba(255,255,255,0.7);border-radius: 10px;">
    <div class="header clearfix" style="margin: 0px; ">
        <img src="/images/pan-top.png" style="max-height: 50px;">
    </div>
    <div style="margin-top: 100px;text-align: center">
        <p style="font-size: xx-large;">请输入提取码</p>
        <div>
            <input  class="mysecret" id="mysecret" type="text"style="font-family: 'Microsoft YaHei UI'">
            <button class="btn btn-info btn-search" id="uploadsec"  onclick="uploadsec()">确定</button>
        </div>
    </div>

</div>
<!--<h1>请输入提取码</h1>-->
<!--<input  class="mysecret" id="mysecret" type="text">-->
<!--<input type="button" class="uploadsec" id="uploadsec"  value="提取" onclick="uploadsec()">-->
<span id="downloadcode" th:text="${link}" style="display: none;" ></span>
<script type="text/javascript">
    $("#mysecret").keydown(function(event){
        if(event.which == "13"){
            uploadsec();
        }
    });

    function uploadsec() {
        var text_result_Temp=$("#mysecret").val();
       //去掉空格
        var text_result=text_result_Temp.replace(/(^\s*)|(\s*$)/g,"");
        $.ajax({
            type: "POST",
            url: "/sharefileSecret",
            data: {link:  $("#downloadcode").text(),secret:text_result},
            dataType: "json",
            success: function (data) {
                var isTrue=data.success;
                if (isTrue){
                    var link=data.msg;
                    document.write("<form action='/share' method='post' name='form1' style='display:none'>");
                    document.write("<input type='hidden' name='link' value="+ link+">");
                    document.write("</form>");
                    document.form1.submit();
                }else{
                    var message=data.msg;
                    document.write("<form action='/errorPage' method='post' name='form1' style='display:none'>");
                    document.write("<input type='hidden' name='message' value="+ message+">");
                    document.write("</form>");
                    document.form1.submit();
                }

            }
        });
    }



</script>
</body>
</html>